import cv2
import matplotlib.pyplot as plt
import numpy as np


def show(img):
    cv2.imshow("img", img)
    cv2.waitKey(0)
    cv2.destroyAllWindows()

# 礼貌=原始输入-开运算结果
# 黑帽=闭运算-原始输入
pie = cv2.imread("./01_Picture/05_Dige.png")
kernel = np.ones((5, 5), np.uint8)
tophat = cv2.morphologyEx(pie, cv2.MORPH_TOPHAT, kernel)
blackhat = cv2.morphologyEx(pie, cv2.MORPH_BLACKHAT, kernel)
res = np.hstack((tophat, blackhat))
show(res)







